package com.dundun.pattern.builder;

public class TextBuilder implements Builder {

    private StringBuilder sb = new StringBuilder();

    @Override
    public void makeTitle(String title) {
        sb.append("===================================\n");
        sb.append("[").append(title).append("]\n\n");
    }

    @Override
    public void makeString(String string) {
        sb.append("■").append(string).append("\n\n");
    }

    @Override
    public void makeItems(String[] items) {
        for(String item : items) {
            sb.append("·").append(item).append("\n");
        }
        sb.append("\n");
    }

    @Override
    public void close() {
        sb.append("===================================\n");
    }

    @Override
    public String getResult() {
        return sb.toString();
    }
}
